<template>
	<el-container>
		<el-aside>
		</el-aside>
		<el-container>
			<el-header>企业微信设置</el-header>
			<el-main>
				<el-form :model="form" :rules="rules">
					<el-form-item label="公司CorpId" label-width="150px" prop="wxCorpId">
						<el-input v-model="form.wxCorpId" placeholder="公司CorpId"></el-input>
					</el-form-item>
					<el-form-item label="微应用AgentId" label-width="150px" prop="wxAgentId">
						<el-input v-model="form.wxAgentId" placeholder="微应用AgentId"></el-input>
					</el-form-item>
					<el-form-item label="微应用AppSecret" label-width="150px" prop="wxAppSecret">
						<el-input v-model="form.wxAppSecret" placeholder="微应用AppSecret"></el-input>
					</el-form-item>
					<el-form-item label="通讯录SyncSecret" label-width="150px" prop="wxSyncSecret">
						<el-input v-model="form.wxSyncSecret" placeholder="通讯录SyncSecret"></el-input>
					</el-form-item>
					<div style="text-align: center">
						<el-button type="primary" @click="submit">保存</el-button>
					</div>
				</el-form>
			</el-main>
		</el-container>
		<el-aside>
		</el-aside>
	</el-container>
</template>

<script>
export default {
	name: 'Weixin Setting',
	data() {
		return {
			form:{
				wxCorpId:'',
				wxAgentId:'',
				wxAppSecret:'',
				wxSyncSecret:''
			},
			rules:{

			}
		}
	},
	mounted() {
		this.getWxConfig();
	},
	methods:{
		async submit()
		{
			var res = await this.$API.system.wxConfig.updateWxConfig.post(this.form)
			if(res.code == 200){
				this.$message.success(res.message);
			}else{
				this.$message.warning(res.message)
			}
		},
		async getWxConfig()
		{
			var res = await this.$API.system.wxConfig.getWxConfig.get();
			if(res.code==200)
			{
				if(res.data)
				{
					this.form = res.data;
				}
			}else {
				this.$message.warning(res.message)
			}
		}
	}
}
</script>

<style>
</style>
